package chap8.innerclass;

public class MyOuterClass {

	public void outerMethodOne(){
		System.out.println("public Outer Method One Called. . . ");
	}
	
	protected void outerMethodTwo(){
		System.out.println("protected Outer Method Two Called. . . ");
	}
	
	private void outerMethodThree() {
		System.out.println("private Outer Method Three Called. . . ");
	}
	
	/**
	 * Calling Inner class from PSVM/ Static Method. . . 
	 */
	
	public static void main(String[] args) {
		MyInnerClass inn = new MyOuterClass().new MyInnerClass();
		inn.innerMethodOne();
		inn.innerMethodTwo();
		inn.innerMethodThree();
		inn.callOuterMethods();
		new MyOuterClass().callInnerMethods();
	}	
		
	/**
	 * Calling Static Inner class from Non Static Outer class. . .
	 * same rule applies for calling from method 
	 */
	
		staticMyInnerClass class1 = new MyOuterClass.staticMyInnerClass();
			
		
	/**
	 * Calling Non Static Inner class from Non Static Outer class. . .
	 * same rule applies for calling from method  
	 */
	
		MyInnerClass inn = new MyInnerClass();
		
		
	
	public void callInnerMethods(){
		MyInnerClass inn = new MyInnerClass();
		inn.innerMethodOne();
		inn.innerMethodTwo();
		inn.innerMethodThree();
		inn.callOuterMethods();		
	}
	
	
	
	class MyInnerClass{
		
		public void innerMethodOne(){
			System.out.println("public Inner Method One Called. . . ");
		}
		
		protected void innerMethodTwo(){
			System.out.println("protected Inner Method Two Called. . . ");
		}
		
		private void innerMethodThree() {
			System.out.println("private Inner Method Three Called. . . ");
		}
		
		
		public void callOuterMethods(){
			outerMethodOne();
			outerMethodTwo();
			outerMethodThree();
		}
		
	}
	
	static class staticMyInnerClass{
		
	}
	
	
}
